/*
 * logger.h
 *
 *  Created on: 26-04-2012
 *      Author: ptab
 */

#ifndef LOGGER_H_
#define LOGGER_H_

#include <stdlib.h>

#define CHECK(x, msg) if (!(x)) { fprintf(stderr, "%s:%d Assertion failed: %s; %s\n", __FILE__, __LINE__, #x, msg); exit(1); };

#ifndef NDEBUG
#define LOG(str, ...) printf(str "\n", ## __VA_ARGS__); fflush(stdout);
#else
#define LOG(str, ...) ;
#endif

#ifdef LIB_LOGGING
#define LIBLOG(str, args...) printf(str "\n", ## args); fflush(stdout);
#else
#define LIBLOG(str, args...) ;
#endif

#endif /* LOGGER_H_ */
